import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/base";

// 查询环境列表
export function listEnv(query) {
    return request({
        url: '/oms/env/',
        method: 'get',
        params: query
    })
}

// 查询环境详细
export function getEnv(id) {
    return request({
        url: `/oms/env/${parseStrEmpty(id)}/`,
        method: 'get'
    })
}

// 查询环境详细历史
export function getHistory(id) {
    return request({
        url: `/oms/env/${id}/history/`,
        method: 'get',
    })
}

// 新增环境
export function addEnv(data) {
    return request({
        url: '/oms/env/',
        method: 'post',
        data: data
    })
}

// 修改环境
export function updateEnv(data) {
    return request({
        url: `/oms/env/${data.id}/`,
        method: 'put',
        data: data
    })
}

// 删除环境
export function delEnv(id) {
    return request({
        url: `/oms/env/${id}/`,
        method: 'delete'
    })
}